Conversation
docs/cookbook/admin_panel/menu.md
Outdated
|
|
||
| ### Opening a link in a new tab | ||
|
|
||
| Target blank directive can be added to link that either are top level menu items without children or children items. In other words this can be configured to item that do not have children. |
There was a problem hiding this comment.
| Target blank directive can be added to link that either are top level menu items without children or children items. In other words this can be configured to item that do not have children. | |
| Target blank directive can be added to links that either are top-level menu items without children or children items. In other words, this can be configured to items that do not have children. |
There was a problem hiding this comment.
I think this sentence is redundant with the next one on line 98 - I think we should delete this one entirely up to line 96 and only keep the line 98 one which is much better.
There was a problem hiding this comment.
I updated the doc like @stlgaits suggested
docs/cookbook/admin_panel/menu.md
Outdated
| { | ||
| $menu = $this->factory->createItem('root'); | ||
| // ... | ||
| $this->aaddApiDocMenuddApiDocMenu($menu); |
There was a problem hiding this comment.
| $this->aaddApiDocMenuddApiDocMenu($menu); | |
| $this->addApiDocMenu($menu); |
There was a problem hiding this comment.
But if we're to follow existing examples, this should be named submenu instead.
| $this->aaddApiDocMenuddApiDocMenu($menu); | |
| $this->addApiDocSubMenu($menu); |
docs/cookbook/admin_panel/menu.md
Outdated
| private function addApiDocMenu(ItemInterface $menu): void | ||
| { | ||
| $library = $menu | ||
| ->addChild('api_doc', [ | ||
| 'route' => 'api_doc', | ||
| ]) | ||
| ->setLabel('app.ui.api_doc') | ||
| ->setLabelAttribute('icon', 'tabler:api') | ||
| ->setLinkAttribute('target', '_blank') // Opens the link in a new tab | ||
| ; | ||
| } |
There was a problem hiding this comment.
| private function addApiDocMenu(ItemInterface $menu): void | |
| { | |
| $library = $menu | |
| ->addChild('api_doc', [ | |
| 'route' => 'api_doc', | |
| ]) | |
| ->setLabel('app.ui.api_doc') | |
| ->setLabelAttribute('icon', 'tabler:api') | |
| ->setLinkAttribute('target', '_blank') // Opens the link in a new tab | |
| ; | |
| } | |
| private function addApiDocSubMenu(ItemInterface $menu): void | |
| { | |
| $apiDoc = $menu | |
| ->addChild('api_doc', [ | |
| 'route' => 'api_doc', | |
| ]) | |
| ->setLabel('app.ui.api_doc') | |
| ->setLabelAttribute('icon', 'tabler:api') | |
| ->setLinkAttribute('target', '_blank') // Opens the link in a new tab | |
| ; | |
| } |
docs/cookbook/admin_panel/menu.md
Outdated
| } | ||
| ``` | ||
|
|
||
| >>>>>>> Stashed changes |
There was a problem hiding this comment.
| >>>>>>> Stashed changes |
| {% tabs %} | ||
| {% tab title="YAML" %} | ||
| {% code title="config/packages/sylius_bootstrap_admin_ui.yaml" lineNumbers="true" %} | ||
| ```yaml |
There was a problem hiding this comment.
Would be cool to have php example as well.
There was a problem hiding this comment.
Indeed, and maybe a small screeenshot of the browser tab as well to make it extra explicit?
| {% endcode %} | ||
| {% endtab %} | ||
|
|
||
|
|
docs/cookbook/admin_panel/menu.md
Outdated
| return $menu; | ||
| } | ||
|
|
||
| private function addApiDocMenu(ItemInterface $menu): void |
There was a problem hiding this comment.
Yes good point to try to remain in userland - possibly an external link to the bookstore's website / blog or to something related to the books ecosystem like Goodreads new releases for instance (e.g. https://www.goodreads.com/book/popular_by_date/2025/5?ref=nav_brws_newrels) ?
There was a problem hiding this comment.
I changed it to a link to the website homepage. This is not in the test app, but we've got something similar in Sylius/Sylius
| {% tabs %} | ||
| {% tab title="YAML" %} | ||
| {% code title="config/packages/sylius_bootstrap_admin_ui.yaml" lineNumbers="true" %} | ||
| ```yaml |
There was a problem hiding this comment.
Indeed, and maybe a small screeenshot of the browser tab as well to make it extra explicit?
docs/cookbook/admin_panel/menu.md
Outdated
|
|
||
| ### Opening a link in a new tab | ||
|
|
||
| Target blank directive can be added to link that either are top level menu items without children or children items. In other words this can be configured to item that do not have children. |
There was a problem hiding this comment.
I think this sentence is redundant with the next one on line 98 - I think we should delete this one entirely up to line 96 and only keep the line 98 one which is much better.
docs/cookbook/admin_panel/menu.md
Outdated
|
|
||
| Target blank directive can be added to link that either are top level menu items without children or children items. In other words this can be configured to item that do not have children. | ||
|
|
||
| This can be configured by setting a link attribute on a menu item: |
There was a problem hiding this comment.
| This can be configured by setting a link attribute on a menu item: |
docs/cookbook/admin_panel/menu.md
Outdated
|
|
||
| ### Opening a link in a new tab | ||
|
|
||
| Target blank directive can be added to link that either are top level menu items without children or children items. In other words this can be configured to item that do not have children. |
There was a problem hiding this comment.
| Target blank directive can be added to link that either are top level menu items without children or children items. In other words this can be configured to item that do not have children. |
| You can make a link open in a new browser tab by adding the `target="_blank"` link attribute to menu items. This can be applied to top-level menu items without children, or to child items themselves. In other words, it only works for items that do not have submenus. | ||
|
|
||
| To configure this behavior, set the target link attribute on the menu item as shown below: | ||
|
|
There was a problem hiding this comment.
| {% code title="src/Menu/MenuBuilder.php" lineNumbers="true" %} |
docs/cookbook/admin_panel/menu.md
Outdated
| } | ||
| } | ||
| ``` | ||
|
|
There was a problem hiding this comment.
| {% endcode %} | |
docs/cookbook/admin_panel/menu.md
Outdated
| return $menu; | ||
| } | ||
|
|
||
| private function addApiDocMenu(ItemInterface $menu): void |
There was a problem hiding this comment.
Yes good point to try to remain in userland - possibly an external link to the bookstore's website / blog or to something related to the books ecosystem like Goodreads new releases for instance (e.g. https://www.goodreads.com/book/popular_by_date/2025/5?ref=nav_brws_newrels) ?
This PR is a follow-up to these comments: